<%@ page language="java"
         contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"
         import="java.util.List"
         import="java.util.Map"
         import="com.shxt.hotel.background.User"
%>
<%
    if(session.getAttribute("id") == null){
        response.sendRedirect("./login.jsp");
    }else{
        User userManager = new User();
        Map<String, Object> currentUser = userManager.getUserInfo((int)session.getAttribute("id"));
%>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <link rel="shortcut icon" href="../Public/img/favicon.html">

    <title>Profile Edit</title>

    <!-- Bootstrap core CSS -->
    <link href="../Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="../Public/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="../Public/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="../Public/css/style.css" rel="stylesheet">
    <link href="../Public/css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="../Public/js/html5shiv.js"></script>
      <script src="../Public/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>

    <section id="container" class="">
        <!--header start-->
        <jsp:include page="./Public/header.jsp" flush="true" />
        <!--header end-->
        <!--sidebar start-->
        <jsp:include page="./Public/sidebar.jsp" flush="true" />
        <!--sidebar end-->
        <!--main content start-->
        <section id="main-content">
            <section class="wrapper">
                <!-- page start-->
                <div class="row">
                    <aside class="profile-nav col-lg-3">
                        <section class="panel">
                            <div class="user-heading round">
                                <a href="#">
                                    <img src="../Public/img/profile-avatar.jpg" alt="">
                                </a>
                                <h1><%=currentUser.get("username") %></h1>
                                <p><%=currentUser.get("phone") %></p>
                            </div>

                            <ul class="nav nav-pills nav-stacked">
                                <li>
                                    <a href="user_profiles.jsp"> <i class="icon-user"></i> Profile</a>
                                </li>
                                <li class="active">
                                    <a href="user_edit.jsp"> <i class="icon-edit"></i> Edit profile</a>
                                </li>
                            </ul>

                        </section>
                    </aside>
                    <aside class="profile-info col-lg-9">
                        <section class="panel">
                            <div class="bio-graph-heading">
                                Profile Info
                            </div>
                            <div class="panel-body bio-graph-info">
                                <h1> Profile Info</h1>
                                <form class="form-horizontal" role="form" action="./background/user_edit_profile_do.jsp" method="post">
                                    <input type="hidden" name="id" value='<%=currentUser.get("id") %>'>
                                    <div class="form-group">
                                        <label class="col-lg-2 control-label">User Name</label>
                                        <div class="col-lg-6">
                                            <input name="username" type="text" class="form-control" id="f-name" placeholder=" " value='<%=currentUser.get("username") %>' autocomplete="off">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-2 control-label">ID Card</label>
                                        <div class="col-lg-6">
                                            <input type="text" class="form-control" id="l-name" placeholder=" " readonly value='<%=currentUser.get("id_card") %>'>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-lg-2 control-label">Phone</label>
                                        <div class="col-lg-6">
                                            <input name="phone" type="text" class="form-control" id="c-name" placeholder=" " autocomplete="off" value='<%=currentUser.get("phone") %>'>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-lg-offset-2 col-lg-10">
                                            <button type="submit" class="btn btn-success">Save</button>
                                            <button type="reset" class="btn btn-danger">Reset</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </section>
                        <section>
                            <div class="panel panel-primary">
                                <div class="panel-heading"> Sets New Password</div>
                                <div class="panel-body">
                                    <form class="form-horizontal" role="form" action="./background/user_edit_password_do.jsp" method="post">
                                        <input type="hidden" name="id" value='<%=currentUser.get("id") %>'>
                                        <div class="form-group">
                                            <label class="col-lg-2 control-label">Current Password</label>
                                            <div class="col-lg-6">
                                                <input name="old_password" type="password" class="form-control" id="c-pwd" placeholder=" ">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-lg-2 control-label">New Password</label>
                                            <div class="col-lg-6">
                                                <input name="password" type="password" class="form-control" id="n-pwd" placeholder=" ">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-lg-2 control-label">Re-type New Password</label>
                                            <div class="col-lg-6">
                                                <input name="re_password" type="password" class="form-control" id="rt-pwd" placeholder=" ">
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <div class="col-lg-offset-2 col-lg-10">
                                                <button type="submit" class="btn btn-info">Save</button>
                                                <button type="Reset" class="btn btn-danger">Reset</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </section>
                    </aside>
                </div>

                <!-- page end-->
            </section>
        </section>
        <!--main content end-->
    </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="../Public/js/jquery.js"></script>
    <script src="../Public/js/bootstrap.min.js"></script>
    <script src="../Public/js/jquery.scrollTo.min.js"></script>
    <script src="../Public/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="../Public/assets/jquery-knob/js/jquery.knob.js"></script>

    <!--common script for all pages-->
    <script src="../Public/js/common-scripts.js"></script>

    <!--scripted by myself-->
    <script>
        $(document).ready(function(){
            $("#User_Oprt").addClass("active");
            $("#hotel_user").addClass("active");
        });
    </script>

</body>

</html>
<%
    }
%>